<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>浅拷贝</title>
</head>

<body>

</body>
<script>
    function shallowCopy() {
        window.obj = {
            a: 1,
            b: [1, 2, 3],
            c: {
                name: 'momo',
                age: 18
            }
        };

        window.obj2 = {
            ...obj
        };

        window.obj3 = Object.assign({}, obj);

        console.log('obj2', obj2);
    }

    shallowCopy();
</script>

</html>